<%@page import="com.nisco.dms.entity.Department"%>
<%@page import="java.util.List"%>
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>

<%!
	public String tree(Department dept) {
		if (dept.getChildren().isEmpty()) {
			return "";
		}
		StringBuffer buffer = new StringBuffer();
		buffer.append("<ul>" + "\n");
		for(Department  d: dept.getChildren()) {
			//注意：$.bringBack中的属性名要和userCreate.jsp中<input class="required" name="dept.strName" type="text" readonly="readonly" />的name保持一致。
			buffer.append("<li><a href=\"javascript:\" onclick=\"$.bringBack({id:'" + d.getId() + "', strName:'" + d.getStrName() + "'})\">" + d.getStrName() + "</a>" + "\n");
			buffer.append(tree(d));
			buffer.append("</li>" + "\n");
		}
		buffer.append("</ul>" + "\n");
		return buffer.toString();
	}
%>
<%
Department dept = (Department)request.getAttribute("dept");
%>
<div class="pageContent">
	<div class="pageFormContent" layoutH="58">
		<ul class="tree expand">
			<li><a href="javascript:"><%=dept.getStrName() %></a>
				<%=tree(dept) %>
			</li>
		</ul>
	</div>
	
	<div class="formBar">
		<ul>
			<li><div class="button"><div class="buttonContent"><button class="close" type="button">关闭</button></div></div></li>
		</ul>
	</div>
</div>
